package luke4fun.wheresmymoney.bean;

import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class DayAccBean {

	private int price;
	private Date expenseDate;
	private Map<String, AccBean> accMap = new LinkedHashMap<String, AccBean>();
	private List<AccBean> accList = new ArrayList<AccBean>(0);

	public DayAccBean() {
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public Date getExpenseDate() {
		return expenseDate;
	}

	public void setExpenseDate(Date expenseDate) {
		this.expenseDate = expenseDate;
	}

	public Map<String, AccBean> getAccMap() {
		return accMap;
	}

	public void setAccMap(Map<String, AccBean> accMap) {
		this.accMap = accMap;
	}

	public AccBean getAcc(int index) {
		return getAccList().get(index);
	}
	
	private List<AccBean> getAccList() {
		if (this.accList.size() != this.accMap.size()) {
			this.accList.clear();
			this.accList.addAll(this.accMap.values());
		}
		return accList;
	}
}
